<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/jquery.min.js"></script>
    <style>
        div{
            width: 150px;
            height: 35px;
        }
    </style>
</head>
<body>
    <div onkeydown="ons()">
    <input type="text" placeholder="请输入">
    <textarea id="fibonacci"></textarea>
    </div>
</body>
<script>
    function ons(){
        if(window.event.keyCode==13){
    var t=$("input").val();
    fibonacci(t);
    }
}
function fibonacci(t){
    var A="";
    var f=1;
    var f1=0;
    var f2=0;
    for(var i=0;i<t;i++){
        A=A+f+"," ;
        f2=f1;
        f1=f;
        f=f1+f2;
}
    document.getElementById("fibonacci").value=A;
    }
</script>
</html>